﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SaleProductsList.ascx.cs" Inherits="UserControls_SaleProductsList" %>
<asp:Image ID="main_banner" runat="server" Height="160px" ImageUrl="~/Images/main_banner.png" Width="700px" ImageAlign="Middle" />
<br />
    <span class="CatalogTitle" style="font-family: tahoma; color: #E87911">&nbsp; TOP 5 Discount Product!!</span>
  <br />
<hr style="height: 0px; width: 694px; text-align: left;" />
<asp:DataList ID="SaleProducts" runat="server" DataSourceID="SaleProductsList" RepeatDirection="Horizontal" DataKeyField="ProductID" CellPadding="10" OnItemCommand="add_ItemCommand" onupdatecommand="rateImageChange">
    <ItemTemplate>
          <a href='Product.aspx?ProductID=<%# Eval("ProductID")%>'>
            <img width="120" height="120" src='ProductImages/<%# Eval("Thumbnail") %>' border="0"/>
          </a>
        <br />
        <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' Width="120px" Font-Size="X-Small" ForeColor="#33CCFF" Height="30px"/>
        <br />
          <span class="ProductPrice" style="text-decoration: line-through; font-family: Tahoma; font-size: x-small; color: #C0C0C0;">
            CDN<%# Eval(" Price", "{0:c}") %></span><br />
        <span class="ProductPrice" style="font-family: Tahoma; color: #FF0000; font-size: small">CDN&nbsp;<%# Eval(" RPrice", "{0:c}") %></span><br /><a href='Rate.aspx?ProductID=<%# Eval("ProductID")%>'><img width="80" height="20" src='Images/<%# Eval("Rating") %>' border="0"/></a><br /><asp:Button ID="addToCartButton" runat="server" Text="Add to Cart" CommandArgument='<%# Eval("ProductID") %>' CssClass="SmallButtonText"/>
    </ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SaleProductsList" runat="server" ConnectionString="<%$ ConnectionStrings:BalloonShopConnection %>" SelectCommand="SELECT TOP (5) ProductID, Name, Price, Thumbnail, Round((Price * Discount / 100),2) AS RPrice, 
(select case when  
 Rating=0 then  'rate_0.0.png' 
when Rating=1 then 'rate_1.0.png'
when Rating=2 then 'rate_2.0.png'
when Rating=3 then 'rate_3.0.png'
when Rating=4 then 'rate_4.0.png'
when Rating=5 then 'rate_5.0.png'
end)
as Rating
 FROM Product ORDER BY Discount DESC"></asp:SqlDataSource>

